Skip to content

Use SegmentedControl for HtmlPreview width switching - #356

Draft
georgerichmond wants to merge 1 commit into
add-toggle-button-groupfrom
html-preview-segmented-control
Draft

georgerichmond wants to merge 1 commit into
add-toggle-button-groupfrom
html-preview-segmented-control

Conversation

@georgerichmond

Copy link
Copy Markdown
Contributor

Stacked on #354 (add-toggle-button-group), which adds SegmentedControl. Rebase onto main once #354 merges.

What does this change?

Updates HtmlPreview (used by HtmlPreviewLoader) to match the Figma design (node 3111:6735):

  • Replaces the RadioGroup width selector with SegmentedControl / SegmentedControlItem. Labels are plain numbers (320, 375, 425, 650).
  • Moves the control out of the header. It now sits below the title, left-aligned with the centred iframe, and moves with it when the width changes. It's still hidden when widthOptions is [].
  • Container: 1px border.weak border, 16px padding, 16px gap between sections. Adds new borderColor, borderStyle, borderWidth and gap tokens.
  • String titles use heading2Xl instead of titleMd. Pass a ReactNode title to include a subtitle.
  • The preview frame's background and border are now transparent, to match the design.
  • The header is only rendered when a title is provided.
  • Updates the MDX wording and the sandbox CSS/JS examples. Adds a patch changeset.

Public props are unchanged. The token defaults have changed, which is fine because no other consumers use this component.

How to test

Check the HtmlPreview and HtmlPreviewLoader stories in Storybook/Chromatic, especially the default, custom width options, without width options, loading, error and reload button stories. Switching width should move the control with the iframe.

Local checks: tsc, eslint, knip, prettier and build-storybook all pass.

Replace the RadioGroup width selector with SegmentedControl, placed
below the header and aligned with the left edge of the centred preview.
Update container tokens and title typography to match the Figma design.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Dependency Compatibility Matrix

React Emotion TypeScript RAC Typecheck Unit E2E Build Overall
17 11.11.4 5.0.4 1.14.0 ok ok ok ok ✅
17 11.11.4 5.0.4 1.21.1 ok ok ok ok ✅
17 11.11.4 5.9.3 1.14.0 ok ok ok ok ✅
17 11.11.4 5.9.3 1.21.1 ok ok ok ok ✅
17 11.11.4 6.0.2 1.14.0 ok ok ok ok ✅
17 11.11.4 6.0.2 1.21.1 ok ok ok ok ✅
17 11.14.0 5.0.4 1.14.0 ok ok ok ok ✅
17 11.14.0 5.0.4 1.21.1 ok ok ok ok ✅
17 11.14.0 5.9.3 1.14.0 ok ok ok ok ✅
17 11.14.0 5.9.3 1.21.1 ok ok ok ok ✅
17 11.14.0 6.0.2 1.14.0 ok ok ok ok ✅
17 11.14.0 6.0.2 1.21.1 ok ok ok ok ✅
18 11.11.4 5.0.4 1.14.0 ok ok ok ok ✅
18 11.11.4 5.0.4 1.21.1 ok ok ok ok ✅
18 11.11.4 5.9.3 1.14.0 ok ok ok ok ✅
18 11.11.4 5.9.3 1.21.1 ok ok ok ok ✅
18 11.11.4 6.0.2 1.14.0 ok ok ok ok ✅
18 11.11.4 6.0.2 1.21.1 ok ok ok ok ✅
18 11.14.0 5.0.4 1.14.0 ok ok ok ok ✅
18 11.14.0 5.0.4 1.21.1 ok ok ok ok ✅
18 11.14.0 5.9.3 1.14.0 ok ok ok ok ✅
18 11.14.0 5.9.3 1.21.1 ok ok ok ok ✅
18 11.14.0 6.0.2 1.14.0 ok ok ok ok ✅
18 11.14.0 6.0.2 1.21.1 ok ok ok ok ✅
19 11.14.0 5.0.4 1.14.0 ok ok ok ok ✅
19 11.14.0 5.0.4 1.21.1 ok ok ok ok ✅
19 11.14.0 5.9.3 1.14.0 ok ok ok ok ✅
19 11.14.0 5.9.3 1.21.1 ok ok ok ok ✅
19 11.14.0 6.0.2 1.14.0 ok ok ok ok ✅
19 11.14.0 6.0.2 1.21.1 ok ok ok ok ✅

Columns show granular outcomes for each dependency set: ok = passed, fail = failed, skip = upstream failure prevented running later stages. Overall: ✅ all passed, ⚠️ only skips (no hard fails), ❌ at least one fail.
Last updated: 2026-11-27T14:35:23.753Z (commit 5621ded)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant